<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
 lang="en" dir="ltr">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="../codebase/default.css" type="text/css" media="screen" title="no title" charset="utf-8"><title>
    dhtmlxconnector:dynamical_loading    [Skin test wiki]
  </title></head>

<body>
<div class="dokuwiki">
  
  <div class="stylehead">

    <div class="header">
    <a class="logo" href="http://dhtmlx.com" title="DHTMLX Documentation homepage"></a>
    <span class="tittle-dhtmlx">DHTMLX Docs & Samples Explorer</span>

    <div class="search-field">
        <form action="http://dhtmlx.com/dhxdocs/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><button type="submit"></button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>    </div>
        <div class="buttons">
                <a class="doc"></a>
                <a title="DHTMLX Samples homepage" href="../samples.html" class="sample"/></a>
        </div>
     <!-- <div class="pagename">
        [[<a href="#"  title="Backlinks">dhtmlxconnector:dynamical_loading</a>]]
      </div>
      <div class="logo">
        <a href="/dhtmlx/_lab/wiki/doku.php"  name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[H]">Skin test wiki</a>      </div>

      <div class="clearer"></div>-->
        
    </div>

    
<!--   <div class="bar" id="bar__top">
      <div class="bar-left" id="bar__topleft">
                <form class="button btn_revs" method="get" action="http://dhtmlx.com/dhxdocs/doku.php"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="hidden" name="id" value="dhtmlxconnector:dynamical_loading" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form>      </div>

      <div class="bar-right" id="bar__topright">
        <form class="button btn_recent" method="get" action="http://dhtmlx.com/dhxdocs/doku.php"><div class="no"><input type="hidden" name="do" value="recent" /><input type="hidden" name="id" value="dhtmlxconnector:dynamical_loading" /><input type="submit" value="Recent changes" class="button" accesskey="r" title="Recent changes [R]" /></div></form>        <form action="http://dhtmlx.com/dhxdocs/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><button type="submit"></button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>&nbsp;
      </div>

      <div class="clearer"></div>
    </div> -->

<!--        <div class="breadcrumbs">
      <span class="bchead">Trace:</span> <span class="bcsep">&raquo;</span> <span class="curid"><a href="/dhtmlx/_lab/wiki/doku.php?id=dhtmlxconnector:dynamical_loading"  class="breadcrumbs" title="dhtmlxconnector:dynamical_loading">dynamical_loading</a></span>    </div>
    -->

    
  </div>
  
  
  <div class="page">
    <!-- wikipage start -->
    
<p>
<div class='backlinks'><div class='backlink last_backlink'><img src="icons___file.gif"  class="media" alt="" /><a href="../index.html" class="wikilink1" title="start">Index</a></div><div class='arrow'></div><div class='backlink last_backlink'><img src="icons___connector.gif"  class="media" alt="" /><a href="index.html" class="wikilink1" title="dhtmlxconnector:toc">dhtmlxconnector</a></div><div class='arrow'></div><div class='backlink'><span class="curid"><a href="dhtmlxconnector___dynamical_loading.html" class="wikilink1" title="dhtmlxconnector:dynamical_loading">  Dynamical Loading  </a></span></div></div>

</p>

<h2><a name="dynamical_loading" id="dynamical_loading">Dynamical Loading</a></h2>
<div class="level2">

<p>

Dynamical Loading mode allows to load data not all at once, but partially, by client side request ( which decrease initial loading time and decrease loading of server ) 
</p>
<ul>
<li class="level1"><div class="li"> grid - smart rendering and paging modes</div>
</li>
<li class="level1"><div class="li"> treegrid - dynamic branch loading mode</div>
</li>
<li class="level1"><div class="li"> tree - dynamic branch loading mode</div>
</li>
<li class="level1"><div class="li"> combo - partial autocomplete ( you need not it for normal autocomplete) </div>
</li>
</ul>
<pre class="code php">        <span class="re0">$conn</span><span class="sy0">-&gt;</span><span class="me1">dynamic_loading</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="re0">$rowsNum</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</pre>
<p>

The parameter(s) are:
</p>
<ul>
<li class="level1"><div class="li">    no parameters for tree, treegrid</div>
</li>
<li class="level1"><div class="li">    number of rows which should be initially loaded (the value should be more than number of rows visible in grid, or at least any positive number) for grid.</div>
</li>
<li class="level1"><div class="li">    maximum number of options which server will send to combo in autocomplete mode for single data request</div>
</li>
</ul>

<p>

To work correctly, related mode need to be enabled on client side as well ( for grid - smart rendring | paging enabled, for tree|treegrid - dynamical loading enabled, for combo - autocomplete enabled ) 
</p>

</div>

<h3><a name="control_of_dyn._loading_for_tree_and_treegrid" id="control_of_dyn._loading_for_tree_and_treegrid">Control of dyn. loading for Tree and TreeGrid</a></h3>
<div class="level3">

<p>

Normally connector make all operations automatically, and need not customization. But in case of dyn. loading in Tree || TreeGrid it possible that DB already have field which shows is current item leaf or branch. By using beforeRender event it possible to mark item as leaf and through that decrease count of <acronym title="Structured Query Language">SQL</acronym> queries generated by component ( which means increase in performance )

</p>
<pre class="code php">	<span class="kw2">function</span> custom_define<span class="br0">&#40;</span><span class="re0">$item</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$item</span><span class="sy0">-&gt;</span><span class="me1">get_value</span><span class="br0">&#40;</span><span class="st0">&quot;is_a_branch&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
			<span class="re0">$item</span><span class="sy0">-&gt;</span><span class="me1">set_kids</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span>;
		<span class="kw1">else</span>
			<span class="re0">$item</span><span class="sy0">-&gt;</span><span class="me1">set_kids</span><span class="br0">&#40;</span><span class="kw2">false</span><span class="br0">&#41;</span>;
	<span class="br0">&#125;</span>
	<span class="re0">$tree</span><span class="sy0">-&gt;</span><span class="me1">event</span><span class="sy0">-&gt;</span><span class="me1">attach</span><span class="br0">&#40;</span><span class="st0">&quot;beforeRender&quot;</span><span class="sy0">,</span><span class="st0">&quot;custom_define&quot;</span><span class="br0">&#41;</span>;</pre>
<p>

The same approach can be used for non-dynamical mode of Tree|TreeGrid as well. It not so necessary , but will  increase data generation performance as well. Package contains two samples of basic tree loading, one of which use forced kids flag setting and second not
</p>
<ul>
<li class="level1"><div class="li"> 01_basic_connector.php - 1.42s - default loading </div>
</li>
<li class="level1"><div class="li"> 01p_basic connector.php - 0.36s - with custom code for kids flag setting</div>
</li>
</ul>

</div>

    <!-- wikipage stop -->
  </div>

  <div class="clearer">&nbsp;</div>

  
  <div class="stylefoot">

    <div class="meta">
      <div class="user">
              </div>
     <!-- <div class="doc">
        dhtmlxconnector/dynamical_loading.txt &middot; Last modified: 2009/07/30 12:56 (external edit)      </div>
    </div>-->

   
    <!--<div class="bar" id="bar__bottom">-->
      <!--<div class="bar-left" id="bar__bottomleft">-->
        <!---->
        <!--<form class="button btn_revs" method="get" action="http://dhtmlx.com/dhxdocs/doku.php"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="hidden" name="id" value="dhtmlxconnector:dynamical_loading" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form>-->
      <!--</div>-->
      <!--<div class="bar-right" id="bar__bottomright">-->
        <!---->
        <!---->
        <!---->
        <!---->
        <!--<form class="button btn_login" method="get" action="http://dhtmlx.com/dhxdocs/doku.php"><div class="no"><input type="hidden" name="do" value="login" /><input type="hidden" name="sectok" value="9bb6ee9b01205569daa7d2c2cc9d0b64" /><input type="hidden" name="id" value="dhtmlxconnector:dynamical_loading" /><input type="submit" value="Login" class="button" title="Login" /></div></form>-->
        <!--<form class="button btn_index" method="get" action="http://dhtmlx.com/dhxdocs/doku.php"><div class="no"><input type="hidden" name="do" value="index" /><input type="hidden" name="id" value="dhtmlxconnector:dynamical_loading" /><input type="submit" value="Index" class="button" accesskey="x" title="Index [X]" /></div></form>-->
        <!--<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;-->
      <!--</div>-->
      <!--<div class="clearer"></div>-->
    <!--</div>-->

  </div>

  

</div>

<div class="footerinc">


</div>

<div class="no"><img src="/dhtmlx/_lab/wiki/lib/exe/indexer.php?id=dhtmlxconnector%3Adynamical_loading&amp;1257950897" width="1" height="1" alt=""  /></div>
     <div class="footer">
        <div class="footer-logo"></div>
        <div class="copyright">Copyright © 1998-2009 DHTMLX LTD.<br />All rights reserved.</div>
            	    </div>
</body>
</html>
